package  
{
	import org.flixel.*;
	
	public class MainMenuState extends ExtendedFlxState
	{
		private var mainTitleText:FlxText;
		private var mainTitleSubtext:FlxText;
		private var clickPropmtText:FlxText;
		
		public function MainMenuState() 
		{
			//title text and randomization
			mainTitleText = new FlxText(0, 20, FlxG.width, "The Astrotatoes in:").setFormat(null, 30, Color.Orange, "center");
			mainTitleSubtext = new FlxText(0, 60, FlxG.width, GameTitle.getTitle()).setFormat(null, 28, Color.Orange, "center");
			add(mainTitleText);
			add(mainTitleSubtext);
			
			//Propmpt text
			clickPropmtText = new FlxText(0, FlxG.height - 100, FlxG.width, "Click to start").setFormat(null, 20, Color.Teal, "center");
			clickPropmtText.alpha = 0;
			add(clickPropmtText);
		}
		
		override public function update():void 
		{
			super.update()
			
			updatePromptFade();
			
			if (FlxG.mouse.justReleased())
			{
				//go to next state
			}
		}
		
		/*
		 * Function fades the click to start prompt in and out
		 * Change fadeSpeedScaleValue to make fadeing faster or slower
		 * */
		private var prompFadeIn:Boolean = true;
		private function updatePromptFade():void
		{
			var fadeSpeedScaleValue:Number = 1.0;
			
			if (prompFadeIn)
			{
				clickPropmtText.alpha += FlxG.elapsed * fadeSpeedScaleValue;
				
				if (clickPropmtText.alpha >= 1.0)
				{
					clickPropmtText.alpha = 1.0;
					prompFadeIn = false;
				}
			}
			else
			{
				clickPropmtText.alpha -= FlxG.elapsed * fadeSpeedScaleValue;
				
				if (clickPropmtText.alpha <= 0.0)
				{
					clickPropmtText.alpha = 0.0;
					prompFadeIn = true;
				}
			}
		}
		
	}

}